//package com.demo.filter;
//
//import org.springframework.stereotype.Component;
//
//import javax.servlet.*;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.servlet.http.HttpSession;
//import java.io.IOException;
//
//@Component
//public class MyFilter implements Filter {
//
//    @Override
//    public void init(FilterConfig filterConfig) throws ServletException {
//    }
//
//    @Override
//    public void doFilter(ServletRequest var1, ServletResponse var2, FilterChain var3) throws IOException, ServletException{
//        HttpServletRequest request = (HttpServletRequest)var1;
//        HttpServletResponse response = (HttpServletResponse) var2;
//        HttpSession session = request.getSession();
//        Object login = session.getAttribute("login");
//        if(login == null){
//            String location = "/login";
//            response.sendRedirect(location);
//        }else{
//            var3.doFilter(request, response);
//        }
//    };
//
//    @Override
//    public void destroy() {
//    }
//}
